import java.io.IOException;

public class ExecuteExternalProcess {

    public static void main(String[] args) {
        try {
            // 定义可执行文件名称和参数
            String executableName = "jdkMan-1.0-SNAPSHOT.exe";
            String parameter = "init";

            // 使用 ProcessBuilder 构建命令
            ProcessBuilder processBuilder = new ProcessBuilder(executableName, parameter);

            // 启动进程
            Process process = processBuilder.start();

            // 等待进程执行完毕
            int exitCode = process.waitFor();

            // 打印执行结果
            System.out.println("Process exited with code: " + exitCode);

        } catch (IOException | InterruptedException e) {
            e.printStackTrace();
        }
    }
}
